/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.controlstudent.ws;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;

/**
 * REST Web Service
 *
 * @author Neil
 */
@Path("controlstudentwsport")
public class ControlStudentWSPort {
    private com.controlstudent.ws_client.ControlStudentWS port;

    @Context
    private UriInfo context;

    /**
     * Creates a new instance of ControlStudentWSPort
     */
    public ControlStudentWSPort() {
        port = getPort();
    }

    /**
     * Invokes the SOAP method hello
     * @param name resource URI parameter
     * @return an instance of java.lang.String
     */
    @GET
    @Produces("text/plain")
    @Consumes("text/plain")
    @Path("hello/")
    public String getHello(@QueryParam("name") String name) {
        try {
            // Call Web Service Operation
            if (port != null) {
                java.lang.String result = port.hello(name);
                return result;
            }
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }
        return null;
    }

    /**
     * Invokes the SOAP method acceso_apoderado
     * @param usu resource URI parameter
     * @param pass resource URI parameter
     * @return an instance of javax.xml.bind.JAXBElement<com.controlstudent.ws_client.Apoderado>
     */
    @GET
    @Produces("application/xml")
    @Consumes("text/plain")
    @Path("acceso_apoderado/")
    public JAXBElement<com.controlstudent.ws_client.Apoderado> getAccesoApoderado(@QueryParam("usu") String usu, @QueryParam("pass") String pass) {
        try {
            // Call Web Service Operation
            if (port != null) {
                com.controlstudent.ws_client.Apoderado result = port.accesoApoderado(usu, pass);
                return new JAXBElement<com.controlstudent.ws_client.Apoderado>(new QName("http//ws_client.controlstudent.com/", "apoderado"), com.controlstudent.ws_client.Apoderado.class, result);
            }
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }
        return null;
    }

    /**
     *
     */
    private com.controlstudent.ws_client.ControlStudentWS getPort() {
        try {
            // Call Web Service Operation
            com.controlstudent.ws_client.ControlStudentWS_Service service = new com.controlstudent.ws_client.ControlStudentWS_Service();
            com.controlstudent.ws_client.ControlStudentWS p = service.getControlStudentWSPort();
            return p;
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }
        return null;
    }
}
